/**
 * @Author: Ghy
 * @Date: 2019/9/9
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2019-09-09 14:38:38
 */
import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 查询机油
export const getPartsInformation = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/PartsInformation/oil`, { params });
// 查询机油格
export const getPartsInformations = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/PartsInformation/KLC`, { params });
// 添加前查询
export const queryAddPart = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/PartsInformation/queryAddPart`, { params });
// 添加
export const addPart = params => axios.post(`${SERVER.DMSCLOUD_PART}/basedata/PartsInformation/addPart`, params);
// 品牌下拉框
export const getAllBrand = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/PartsInformation/getAllBrand`, params);
// 车型下拉框
export const getAllModel = params => axios.get(`${SERVER.DMSCLOUD_PART}/basedata/PartsInformation/queryAllModel`, params);
// 删除保养备件根据备件代码
export const delPartById = delPartNo => axios.delete(`${SERVER.DMSCLOUD_PART}/basedata/PartsInformation/${delPartNo}`);
// 机油列表导出
export const getExcelList = (params = {}) => {
  for (const key in params) {
    if (!params[key]) {
      params[key] = '';
    }
  }
  const url = `${SERVER.DMSCLOUD_PART}/basedata/PartsInformation/getOilOne/exportExcel` + '?limit=100000&pageNum=' + params.pageNum;
  return axios({
    url,
    method: 'get',
    responseType: 'blob'
  });
};
export const getExcelList_two = (params = {}) => {
  for (const key in params) {
    if (!params[key]) {
      params[key] = '';
    }
  }
  const url = `${SERVER.DMSCLOUD_PART}/basedata/PartsInformation/getOilTwo/exportExcel` + '?limit=100000&pageNum=' + params.pageNum;
  return axios({
    url,
    method: 'get',
    responseType: 'blob'
  });
};
